/*
 * @Author: 徐建辰
 * @Date: 2022-02-12 09:34:50
 * @LastEditTime: 2022-02-17 11:02:26
 * @LastEditors: 徐建辰
 * @Description: vite全局配置
 */
import {fileURLToPath, URL} from 'url'

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import styleImport, {VantResolve} from 'vite-plugin-style-import'

// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  plugins: [
    vue(),
    styleImport({
      resolves: [VantResolve()]
    })
    // vitePluginImp({
    //   libList: [
    //     {
    //       libName: 'vant',
    //       style(name) {
    //         if (/CompWithoutStyleFile/i.test(name)) {
    //           return false
    //         }
    //         return `vant/es/${name}/style/index.js`
    //       }
    //     }
    //   ]
    // })
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
    extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
  },
})
